package com.szl.controller;

import com.szl.annaotation.SzlRequestMapping;
import com.szl.annaotation.SzlRequestParameter;
import com.szl.service.SzlTestService;

import netscape.javascript.JSObject;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import com.szl.annaotation.SzlAutowired;
import com.szl.annaotation.SzlController;

@SzlController("szlTestController")
@SzlRequestMapping("/testPath")
public class SzlTestController {
	
	@SzlAutowired("szlTestService")
	private SzlTestService szltestService;
	
    @SzlRequestMapping("/query")
	public void query(HttpServletRequest request,HttpServletResponse response,
			@SzlRequestParameter("age") String age,
			@SzlRequestParameter("name") String name) throws IOException{
    	
    	PrintWriter pr = response.getWriter();
    	
    	List<Map<String,Object>> list= szltestService.query(age, name);
    	
    	pr.write(JSONObject.toJSONString(list));
	}
}
